var $ = require;
var dbconfig = $('../config').dbconfig,
    DBWrapper = $('node-dbi').DBWrapper,
    async = require('async');

var dbWrapperUtil = {
    config: dbconfig,
    getDBWrapper: function(){
        return new DBWrapper(dbconfig.adapter, dbconfig);
    },
    dbtemplate: function (dbfunktion){
        var me = this;
        var dbwrapper = me.getDBWrapper();
        dbwrapper.connect();
        dbfunktion(dbwrapper, function(){
            dbwrapper.close();
        });
    }
};
module.exports = dbWrapperUtil;
